package com.sun.test;

public class Demo01 {
    public static void main(String[] args) {
        int[] a = {16,29,33,47,56,66};
        int[] b = deom(a,4);
        for (int i = 0; i < a.length; i++) {
            System.out.println(b[i]);

        }
    }
    public static int[] deom(int[] a,int p){

        int z = 0;
        for (int i = 0; i < a.length; i++) {
            if(a[i]%3==0){
                z++;
            }
        }
        int[] b = new int[z];
        int c = 0;
        for (int i = 0; i < a.length; i++) {
            if (a[i]%3==0){
                b[c] = a[i];
                c++;
            }
        }
        return b;
    }
}


